﻿using Abp.Domain.Entities;
using Basefr.Core.Entities;
using System.ComponentModel.DataAnnotations;

namespace Basefr.Core.Auth.Entities
{
    /// <summary>
    /// 用户
    /// </summary>
    public abstract class UserBase<TUser> : AuditedEntityBase<long, TUser>, IPassivable, IMayHaveTenant, IPreDefined
        where TUser : UserBase<TUser>
    {
        public const string DefaultAdminName = "admin";
        public const string DefaultAdminPassword = "123";

        public int? TenantId { get; set; }

        public bool IsActive { get; set; }

        /// <summary>
        /// 用户登录名
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string UserName { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [MaxLength(100)]
        public string Name { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        [MaxLength(100)]
        public string Phone { get; set; }

        /// <summary>
        /// Email
        /// </summary>
        [MaxLength(100)]
        public string Email { get; set; }

        /// <summary>
        /// Hash后的密码
        /// </summary>
        [MaxLength(200)]
        public string Password { get; set; }

        /// <summary>
        /// 密码Salt
        /// </summary>
        [MaxLength(50)]
        public string PasswordSalt { get; set; }

        /// <summary>
        /// 预定义
        /// </summary>
        public bool IsPreDefined { get; set; }
    }
}
